home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / ae / code / ax3.00 / load_account.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-01-03  |  1.1 KB  |  54 lines

  1. #include "bbs.h"
  2.  
  3. /* Loads User & User.Keys for a particular user */
  4.  
  5.  
  6. int Load_Account(int slot, struct User *hoozer, struct UserKeys *hoozer2)
  7. {
  8.  BPTR fh;
  9.  long stat;
  10.  --slot;
  11.  
  12.  //strcpy(GSTR1,Cmds->BBSLoc);
  13.  //strcat(GSTR1,"User.Data");
  14. strcpy(GSTR1,UserDataLoc);
  15.  fh=Open(GSTR1,MODE_OLDFILE);
  16.  if(fh==NULL)  return(FAILURE);
  17.  
  18.  stat=MySeek(fh,(((long)sizeof(struct User))*(long)slot),OFFSET_BEGINNING);
  19.  if(stat!=(((long)sizeof(struct User))*(long)slot)) {
  20.         Close(fh);
  21.         return(FAILURE);
  22.     }
  23.  
  24.  stat=Read(fh,(char *)hoozer,sizeof(struct User));
  25.  if(stat!=sizeof(struct User)) {
  26.      Close(fh);
  27.         return(FAILURE);
  28.     }
  29.  
  30. Close(fh);
  31.  
  32.  //strcpy(GSTR1,Cmds->BBSLoc);
  33.  //strcat(GSTR1,"User.keys");
  34. strcpy(GSTR1,UserKeyLoc);
  35.  fh=Open(GSTR1,MODE_OLDFILE);
  36.  if(fh==NULL)  return(FAILURE);
  37.  
  38.  stat=MySeek(fh,(((long)sizeof(struct UserKeys))*(long)slot),OFFSET_BEGINNING);
  39.  if(stat!=(((long)sizeof(struct UserKeys))*(long)slot)) {
  40.      Close(fh);
  41.         return(FAILURE);
  42.     }
  43.  
  44.  stat=Read(fh,(char *)hoozer2,sizeof(struct UserKeys));
  45.  if(stat!=sizeof(struct UserKeys)) {
  46.      Close(fh);
  47.         return(FAILURE);
  48.     }
  49.  
  50.  Close(fh);
  51.  
  52.  return(SUCCESS);
  53. }
  54.